import React, { Component } from 'react'
//导入basicRoute
import {basicRoute} from '@routes'
//带入配置路由的插件
import {Switch,Route,Redirect} from "react-router-dom"

export default class App extends Component {
  render() {
    return (
     <Switch>
       {/* 开始配置路由，利用循环渲染出路由配置 */}
       {
         basicRoute.map((route)=>{
           return (
             <Route 
             key={route.path}
             path={route.path}
             component={route.component}
             />
           )
         })
       }
       {/* 配置需要重定向的路由 */}
       <Redirect to="/admin" from="/" exact/>
       <Redirect to="/404" />
     </Switch>
    )
  }
}
